//
//  DDTCPListenThread.h
//  PrivateCloud
//
//  Created by mars on 13-10-19.
//  Copyright (c) 2013年 sarah doo. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "GCDAsyncSocket.h"
#import "DDHdrCloud.h"
#import "DDVerifyThread.h"
#import "DDUploadFile.h"
#import "DDConnectCompleteCallback.h"
#import "DDDownloadBookComplete.h"
#import "DDRefreshCompleteCallback.h"

@interface DDTCPListenThread : NSObject
{
    GCDAsyncSocket *recvSocket;
    DDHdrCloud* curHdr;
    DDVerifyThread* sendThread;
    
    
}

@property (nonatomic,retain)GCDAsyncSocket *recvSocket;
@property (nonatomic,retain)DDHdrCloud* curHdr;
@property (nonatomic,retain)DDVerifyThread* sendThread;
@property (nonatomic,retain)id<DDConnectCompleteCallback> connectCompleteCallback;
@property (nonatomic,retain)id<DDDealFileCallback> dealFileCallback;
@property (nonatomic,retain)id<DDDownloadBookComplete> downloadBookCallback;
@property (nonatomic,retain)id<DDRefreshCompleteCallback> refreshCallback;

//当前正在下载的文件列表对象
@property (nonatomic,assign)NSArray* currentDownloadFileList;

//用于统计下载进度的变量
@property (nonatomic,assign)long totalLength;
@property (nonatomic,assign)long alreadyDownloadLength;
@property (nonatomic,assign)int currentPer;

@property (nonatomic,assign)BOOL remeberFlag;

-(id)init;
-(void)recvUploadFileCmd:(DDUploadFile*)uploadFile;
+(void)closeAndClear;
- (void)save:(NSString*)urlString;
+ (DDTCPListenThread *)sharedTCPListener;
- (void)saveV:(NSString*)urlString;
- (void)copyTempVideoToMediaLibrary :(NSString *)videoURL;

@end
